package com.visikard.response;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;

import com.visikard.item.ItemTransactionHistory;
import com.visikard.request.ParseRequesUtils;

public class TransactionHistoryResponse extends BaseResponse {
	private List<ItemTransactionHistory> listTransactionGiftKards;

	public List<ItemTransactionHistory> getListTransactionGiftKards() {
		return listTransactionGiftKards;
	}

	public void setListTransactionGiftKards(List<ItemTransactionHistory> listTransactionGiftKards) {
		this.listTransactionGiftKards = listTransactionGiftKards;
	}

	@Override
	public void extractDataFromServer(String response) throws JSONException {
		super.extractDataFromServer(response);

		if (errorCode == SUCCESS) {
			ArrayList<ItemTransactionHistory> mListItem = new ArrayList<ItemTransactionHistory>();
			JSONArray jDataObj = getDataJArray(response);
			mListItem = ParseRequesUtils.parseTransactionHistoryNew(jDataObj);
			listTransactionGiftKards = mListItem;
		}
	}

}
